<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link href="css/index1.css" rel="stylesheet">
<script type="text/javascript" src="jquery/jquery-1.8.2.js"></script>
</head>
<body>
<form action="addarticle" method="post" enctype="multipart/form-data">
	<table>
		<tr>
			<td>文章标题</td><td><input type="text" name="title"> </td>
		</tr>
		<tr>
			<td>文章图片</td><td><input type="file" name="myFile" > </td>
		</tr>
		<tr>
			<td>所属频道</td><td><select id="se1" name="channelId">
									<option value="">=请选择=</option>
								</select> </td>
		</tr>
		<tr>
			<td>所属分类</td><td><select id="se2" name="categoryId">
									<option value="">=请选择=</option>
								</select> </td>
		</tr>
		<tr>
			<td>文章内容</td><td><input type="text" name="content"> </td>
		</tr>
		<tr><td colspan="2"><button>保存</button> </td> </tr>
	</table>

</form>

<script type="text/javascript">
	$.post(
		"selectchannel",
		{},
		function (mas) {
			for (var i = 0; i < mas.length; i++) {
				$("#se1").append("<option value='"+mas[i].id+"'>"+mas[i].name+"</option>");
			}
		},
		"json"
	)
	$.post(
		"selectcategory",
		{},
		function (mas) {
			for (var i = 0; i < mas.length; i++) {
				$("#se2").append("<option value='"+mas[i].id+"'>"+mas[i].name+"</option>");
			}
		},
		"json"
	)

</script>

</body>
</html>